function features = ComputeFeatures(img)
% Compute a feature vector for all pixels of an image. You can use this
% function as a starting point to implement your own custom feature
% vectors.
%
% INPUT
% img - Array of image data of size h x w x 3.
%
% OUTPUT
% features - Array of computed features for all pixels of size h x w x f
%            such that features(i, j, :) is the feature vector (of
%            dimension f) for the pixel img(i, j, :).
    
%     img = double(img);
    height = size(img, 1);
    width = size(img, 2);
    
    features = zeros([height, width, 8]);
    img_single=single(rgb2gray(img));
    [Gmag, Gdir] = imgradient(img_single,'prewitt');
    BW = edge(img_single,'Canny');
    features(:,:,1:3)=img;
    y_array=(1:height)';
    x_array=1:width;
    features(:,:,4)=repmat(x_array,height,1);
    features(:,:,5)=repmat(y_array,1,width);
    features(:,:,6)=Gmag;
    features(:,:,7)=Gdir;
    features(:,:,8)=BW;
%     peak_thresh=0.5;
%     edge_thresh=3;
%     [f,d]=vl_sift(img_single,'PeakThresh', peak_thresh,'edgethresh', edge_thresh);
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    %                                                                         %
    %                              YOUR CODE HERE                             %
    %                                                                         %
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end